#include <assert.h>
#include <stdint.h>
#ifndef __HASH__
#define __HASH__
struct elem_s
{
    uint32_t key;
    uint32_t data_len;
    struct elem_s *next;
    struct elem_s *priv;
    void          *data;
};
struct hashtb_s
{
    uint32_t  len;
#ifdef _HASHFN_TEST_
    uint32_t  *hash_count;
    uint32_t  total_count;
#endif
    unsigned long int  (*hash_fn)(char *s, int size);
    struct elem_s elem[0];
};
extern void* hash_init(uint32_t size, struct hashtb_s* hashtbp, 
                     uint32_t (*hash_fn)(unsigned char *s, int size));
extern int hash_insert(struct elem_s *elemp, struct hashtb_s* hashtbp);
extern int hash_search(struct elem_s *elemp, struct hashtb_s* hashtbp);
#endif
